<%--
  Created by IntelliJ IDEA.
  User: 10171225
  Date: 2016/3/4
  Time: 14:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>"/>
    <title>编辑文章</title>
    <%--<script type="text/javascript">--%>
    <%--$(document).ready(function () {--%>
    <%--$("#get").click(function () {--%>
    <%--$.ajax( {--%>
    <%--type : 'GET',--%>
    <%--contentType:"application/json",--%>
    <%--url : 'article/get',--%>
    <%--dataType : 'json',--%>
    <%--success : function(data) {--%>
    <%--alert(data);--%>
    <%--alert(data.title);--%>
    <%--},--%>
    <%--error : function() {--%>
    <%--alert("error")--%>
    <%--}--%>
    <%--});--%>
    <%--});--%>
    <%--});--%>

    <%--</script>--%>
</head>
<body>
<div>
    <div class="container">
        <div>
            <jsp:include page="head.jsp"/>
        </div>
            <form action="article/editSubmit" method="post">
                <span>文章标题：</span>
                <input type="text" id="title" name="title" size="20em"/><br/>
                <span>文章内容：</span>
                <script id="container" name="content" type="text/plain">
                </script>
                <span>标签</span>
                <select id="tag" name="tag">
                    <option value ="红球" selected="selected">红球</option>
                    <option value ="篮球">篮球</option>
                </select>
                <br/>
                <button name="submit" type="submit">提交</button>
            </form>

        <script type="text/javascript" src="plugins/ueditor/ueditor.config.js"></script>
        <script type="text/javascript" src="plugins/ueditor/ueditor.all.js"></script>
        <script type="text/javascript">
                $(document).ready(function () {
                    var id = '${article.id}';
                    var title = '${article.title}';
                    var content = '${article.content}';
                    var tag = '${article.tag}';
                    var ue = UE.getEditor('container');
                    ue.ready(function () {
                        ue.setContent(content);
                    });
                    $("#title").val(title);
                    $("#tag").val(tag);

                    $("form").append('<input type="text" name="articleId" hidden="hidden" value="' + id + '"/>');
                });
            </script>
        </div>
</div>
</body>
</html>
